package com.twu.biblioteca.model;

public class User {
    private String libraryNumber;
    private String name;
    private String email;
    private String phoneNumber;
    private String password;

    public User(String libraryNumber, String name, String email, String phoneNumber, String password) {
        this.libraryNumber = libraryNumber;
        this.name = name;
        this.email = email;
        this.phoneNumber = phoneNumber;
        this.password = password;
    }

    public boolean verifyPassword(String password) {
        return this.password.equals(password);
    }

    public void printUserInfo(){
        System.out.println(String.format("Library Number: %s\n" +
                                            "Name : %s\n" +
                                            "E-Mail : %s\n" +
                                            "Phone : %s",libraryNumber,name,email,phoneNumber));
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        User user = (User) o;

        if (!libraryNumber.equals(user.libraryNumber)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return libraryNumber.hashCode();
    }

    public String getLibraryNumber() {
        return libraryNumber;
    }
}
